package com.briup;

/**
 * 创建线程的方式
 *
 * 知识点：
 *      1>线程启动的方式：Thread、Runnable、线程池（Executors）
 * @auther thb
 * @date 2021/9/3
 */
public class T2_HowToCreateThread {

    public static void main(String[] args) {
        new MyThread().start();
        new Thread(new MyRun()).start();
        new Thread(() -> {
            System.out.println("thread lambda name：" + Thread.currentThread().getName());
        }).start();
        System.out.println("main name：" + Thread.currentThread().getName());
    }

}

class MyThread extends Thread {
    @Override
    public void run() {
        System.out.println("myThread name：" + Thread.currentThread().getName());
    }
}

class MyRun implements Runnable {
    @Override
    public void run() {
        System.out.println("myRun name：" + Thread.currentThread().getName());
    }
}
